package com.group9.dto;

import com.group9.pojo.ResourceComment;

import java.util.List;

/**
 * 分页信息
 * Created by Lcouncillor on 2020/6/6.
 */
public class PageInfo {

    /**
     * 当前页第一个数据下标，从0开始
     */
    private Integer pageNum = 0;

    /**
     * 一页显示数据个数
     */
    private Integer pageSize = 3;

    /**
     * 当前页为第几页，从1开始
     */
    private Integer currentPage = 1;

    /**
     * 总页数
     */
    private Integer totalSize;

    /**
     * 当前页评论内容
     */
    private List<ResourceComment> dataList;


    public Integer getPageNum() {
        return pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(Integer currentPage) {
        if (currentPage == null){
            return;
        }
        this.currentPage = currentPage;
        this.pageNum = this.pageSize*(currentPage-1);
    }

    public Integer getTotalSize() {
        return totalSize;
    }

    public void setTotalSize(Integer totalSize) {
        this.totalSize = totalSize;
    }

    public List<ResourceComment> getDataList() {
        return dataList;
    }

    public void setDataList(List<ResourceComment> dataList) {
        this.dataList = dataList;
    }

    @Override
    public String toString() {
        return "PageResult{" +
                "pageNum=" + pageNum +
                ", pageSize=" + pageSize +
                ", totalSize=" + totalSize +
                ", dataList=" + dataList +
                '}';
    }
}
